public class lianxi {

public static void main(String[] args) {

int[] arr = { 1, 2, 3, 4, 5 };

System.out.print("删除前:");

show(arr);

int[] brr = new int[arr.length - 1];

int idx = 0;

for (int i : arr) {

if (i != 3) {

brr[idx++] = i;

}

}

System.out.print("删除后:");

show(brr);

}

private static void show(int[] arr) {

for (int i : arr) {

System.out.print(i + ",");

}

System.out.println();

}

}
